﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Xml.XPath;
using System.Net;
using System.IO;
using System.Xml;
using Newtonsoft.Json;

namespace TwentyTree4Umbraco
{
    public class XSLTExtensions
    {
        public static string GetDomain()
        {
            return Config.GetSetting("domain");
        }
        public static XPathNodeIterator ConvertJson(string WebRequestUrl)
        {
            WebRequest request = WebRequest.Create(WebRequestUrl);
            try
            {
                WebResponse response = request.GetResponse();
                Stream responseStream = response.GetResponseStream();
                StreamReader reader = new StreamReader(responseStream);

                XmlDocument xd = new XmlDocument();

                XmlNode result = JsonConvert.DeserializeXmlNode(reader.ReadToEnd(), "TwentyThree");

                response.Close();
                responseStream.Close();

                return result.CreateNavigator().Select(".");
            }
            catch (Exception err)
            {
         
            }

            return null;
        }
    }
}
